package site.jlopen.assets.shiro.token;

import org.apache.shiro.authc.UsernamePasswordToken;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class SessionToken extends UsernamePasswordToken {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6296998560752326185L;

	/**
	 * The username
	 */
	private String username;

	/**
	 * The password, in char[] format
	 */
	private char[] password;

	/**
	 * Whether or not 'rememberMe' should be enabled for the corresponding login attempt; default is <code>false</code>
	 */
	private boolean rememberMe = false;

	/**
	 * The location from where the login attempt occurs, or <code>null</code> if not known or explicitly omitted.
	 */
	private String host;

	public SessionToken(final String username, final String password, final boolean rememberMe) {
		this(username, password != null ? password.toCharArray() : null, rememberMe, null);
	}

	public SessionToken(final String username, final char[] password, final boolean rememberMe, final String host) {

		this.username = username;
		this.password = password;
		this.rememberMe = rememberMe;
		this.host = host;
	}
}
